package com.qs.rocketmq.mb.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.qs.rocketmq.mb.dto.Page;
import com.qs.rocketmq.mb.dto.PageDTO;
import com.qs.rocketmq.mb.dto.UserDTO;
import com.qs.rocketmq.mb.entity.User;
import com.qs.rocketmq.mb.mapper.UserMapper;
import com.qs.rocketmq.mb.service.UserService;
import com.qs.rocketmq.mb.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public PageDTO<UserDTO> listPage(Page<UserDTO> page, UserDTO userDTO) {
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        List<User> userList = userMapper.getUserList(userDTO);
        return PageUtil.wrapPageDTO(userList, UserDTO.class);
    }
    
}
